<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>我的请求</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/extends/zTree_v3/css/zTreeStyle/zTreeStyle.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
        var multipartMaxSize = '${multipartMaxSize}';
    </script>
</head>
<body>

<form id="frmWorkFlow" class="layui-form" style="height:100%;overflow: auto;padding:2px 16px 16px 16px">
    <div class="noprint commonDiv topHeight">
        <#if handover=="">
            任务审批处理--<b>${task.name}</b>--<i>[${actDefModel.name}-V${actDefModel.version}]</i>
        </#if>
        <#if handover=="true">
            任务明细--<b>${task.name}</b>--<i>[${actDefModel.name}-V${actDefModel.version}]</i>
        </#if>
    </div>

    <div class="noprint commonDiv topHeight">
        <#if handover=="">
            <#if task.executionId=="" && task.description=='15'>
                <#--沟通意见弹窗-->
                <#include  "/bpmNodeButton/incTaskNotify.html">
            <#elseif  task.executionId=="" && (task.description=='38'||task.description=='39')>
                <#include  "/bpmNodeButton/incTaskTransTo.html">
            <#else>
                <#include  "/bpmNodeButton/incToolBarNode.html">
            </#if>
        </#if>
        <#if handover=="true">
            <#include  "/bpmNodeButton/incHandoverInfo.html">
        </#if>
    </div>


    <#if bpmNodeSet.isHidePath==0||isManage==1>
    <!--选择下一步节点的执行人-->
        <div id="jumpDiv" class="noprint" style="display:none;" tipInfo="正在加载表单请稍候..."></div>
    </#if>

    <!--不隐藏意见表单、非沟通、非流转任务-->
    <#if handover=="" && bpmNodeSet.isHideOption ==0 && task.description!='15' &&  task.description!='38' && task.description!='39'>
        <#if bpmNodeSet.isPopup==0>
        <fieldset class="layui-elem-field opinionFieldSet">
            <legend>意见框</legend>
            <div class="layui-field-box">
        </#if>
        <div class="noprint" id="opinionDiv">
            <div class="layui-form-item layui-hide" id="selectNodeDiv">
                <label class="layui-form-label">回退节点</label>
                <div class="layui-input-inline" style="width: 400px;">
                    <input type="hidden" name="backNodeIds">
                    <input id="backNodes" name="backNodes" style="width: 80%; display: inline-block" placeholder="请选择回退节点" type="text" class="layui-input">
                    <a class="layui-btn layui-btn-sm selectFreeBackNodes"><i class="iconfont iconzuzhixiaxia"></i>选择...</a>
                </div>
            </div>
            <#if taskAppItems?? && (taskAppItems?size > 0)>
            <div class="layui-form-item">
                <label class="layui-form-label">常用语选择</label>
                <div class="layui-input-inline">
                    <select  id="selTaskAppItem" lay-filter="selTaskAppItem">
                        <option value="">-- 请选择 --</option>
                        <#list taskAppItems as item>
                        <option value="${item}">${item}</option>
                        </#list>
                    </select>
                </div>
            </div>
            </#if>
            <div class="layui-form-item">
                <label class="layui-form-label">审批意见</label>
                <div class="layui-input-inline" style="width: 400px;">
                    <textarea id="voteContent" name="voteContent" placeholder="请输入内容" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item" id="uploadFileDiv">
                <label class="layui-form-label">附件</label>
                <div class="layui-input-inline" style="width: 400px;">
                    <button type="button" class="layui-btn" id="attachment">
                        上传附件
                    </button>
                    <ul class="attachmentList" id="attachmentList">

                    </ul>
                </div>
            </div>
        </div>
        <#if bpmNodeSet.isPopup==0>
                </div>
            </fieldset>
        </#if>
    <#else>
        <div class="noprint" id="opinionDiv">
            <div class="layui-form-item layui-hide" id="selectNodeDiv">
                <label class="layui-form-label">回退节点</label>
                <div class="layui-input-inline" style="width: 400px;">
                    <input type="hidden" name="backNodeIds">
                    <input id="backNodes" name="backNodes" style="width: 80%; display: inline-block" placeholder="请选择回退节点" type="text" class="layui-input">
                    <a class="layui-btn layui-btn-sm selectFreeBackNodes"><i class="iconfont iconzuzhixiaxia"></i>选择...</a>
                </div>
            </div>
            <#if taskAppItems?? && (taskAppItems?size > 0)>
                <div class="layui-form-item">
                    <label class="layui-form-label">常用语选择</label>
                    <div class="layui-input-inline">
                        <select  id="selTaskAppItem" lay-filter="selTaskAppItem">
                            <option value="">-- 请选择 --</option>
                            <#list taskAppItems as item>
                                <option value="${item}">${item}</option>
                            </#list>
                        </select>
                    </div>
                </div>
            </#if>
            <div class="layui-form-item">
                <label class="layui-form-label">审批意见</label>
                <div class="layui-input-inline" style="width: 400px;">
                    <textarea id="voteContent" name="voteContent" placeholder="请输入内容" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item" id="uploadFileDiv">
                <label class="layui-form-label">附件</label>
                <div class="layui-input-inline" style="width: 400px;">
                    <button type="button" class="layui-btn" id="attachment">
                        上传附件
                    </button>
                    <ul class="attachmentList" id="attachmentList">

                    </ul>
                </div>
            </div>
        </div>
    </#if>

    <div>
        <#if isFormEmpty>
            <div class="noForm">没有设置流程表单。</div>
        <#else>
            <#if isExtForm>
                <!--url表单-->
                <div id="divExternalForm" formUrl="${form}"></div>
            <#else>
                <!--在线表单-->
                <div class="panel-detail" id="customFormDiv"></div>
                <input type="hidden" include="1" name="formKey" value="${formKey}"/>
            </#if>
        </#if>
    </div>

    <input type="hidden" id="taskId" include="1" name="taskId" value="${task.id}"/>
    <!--驳回和撤销投票为再次提交 -->
    <#if processRun.status=="5" || processRun.status=="6">
        <input type="hidden" include="1" id="voteAgree" name="voteAgree" value="34"/>
    <#else>
        <input type="hidden" include="1" id="voteAgree" name="voteAgree" value="1"/>
    </#if>
    <input type="hidden" include="1" id="back" name="back" value=""/>
    <input type="hidden" include="1" id="procDefId" name="procDefId" value="${procDefId}"/>
    <input type="hidden" include="1" name="modelId" value="${actDefModel.id}"/>
    <input type="hidden" include="1" id="isManage" name="isManage" value="${isManage}"/>
    <input type="hidden" include="1" id="businessKey" name="businessKey" value="${processRun.businessKey}"/>
    <input type="hidden" include="1" id="startNode" name="startNode" value="${toBackNodeId}"/>
    <input type="hidden" include="1" name="curUserId" value="${curUserId}"/>
    <input type="hidden" include="1" name="curUserName" value="${curUserName}"/>
    <input type="hidden" include="1" id="taskDefinitionKey" name="taskDefinitionKey" value="${task.taskDefinitionKey}"/>
    <input type="hidden" include="1" name="formKey" value="${formKey}"/>

</form>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<!--<script src="${ctx}/formStatic/form/form.js"></script>-->
<!--<script src="${ctx}/formStatic/verify.js"></script>-->
<script>
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','setter','element','layer','publicMethods','form','upload'], function () {
        var setter=layui.setter
            ,$ = layui.$
            ,layer = layui.layer
            ,publicMethods=layui.publicMethods
            ,form = layui.form
            ,upload = layui.upload;
        //是否是选择路径跳转
        var isHandChoose ="${isHandChoose}";
        //是否隐藏路径
        var isHidePath ="${isHidePath}";
        //是否管理员
        var isManage ="${isManage}";
        var opinionDialogIndex;
        var isExtForm="${isExtForm}";
        var isFormEmpty="${isFormEmpty}";
        //是否弹窗
        var isPopup = "${bpmNodeSet.isPopup}";
        //意见框是否必填
        var isRequired = '${bpmNodeSet.isRequired}';
        var canUploadFile = '${bpmNodeSet.canUploadFile}';
        var dataPrivacyLevel = '${dataPrivacyLevel}';
        var isFirstNode = ${isFirstNode?string('true','false')};
        //是否隐藏意见表单
        var isHideOption = '${bpmNodeSet.isHideOption}';
        //操作类型
        var operatorType=0;
        var runId = "${processRun.runId}";
        var nodeId = "${nodeId}";
        var curUserId = "${curUserId}";

        var opinionDialogH = '400px';

        //初始化定义高度
        // $("#customFormDiv").height($("#frmWorkFlow").height()-$(".topHeight").height()-60);
        //全局使用。即所有弹出层都默认采用，但是单个配置skin的优先级更高
        layer.config({
            skin: 'btn-class'
        });
        upload.render({
            elem: "#attachment",
            url: serverPath.qbdmsPath + setter.sysLinkPath +'attachFile/fileUpload',
            multiple:true,
            size: multipartMaxSize,
            accept:'file',
            number:4,
            auto:true,
            done:function(res,index,upload){
                if(res.code === 0 && res.data && res.data.fileList.length > 0){
                    var fileOne = res.data.fileList[0],
                        str = '<li fileId='+fileOne.fileId+'><span>'+fileOne.fileName+'.'+fileOne.extName+'</span><i class="layui-icon layui-icon-delete deleteFile" ></i></li>';
                    $("#attachmentList").append(str);
                }
            }
        });

        // 删除附件
        $(document).on('click', '.deleteFile', function () {
            $(this).parent().remove();
        });

        // 加上判断是否需要弹出意见对话框
        if(canUploadFile != 1){
            $("#uploadFileDiv").addClass("layui-hide");
            opinionDialogH = '300px';
        }else {
            $("#uploadFileDiv").removeClass("layui-hide");
            opinionDialogH = '400px';
        }

        //选择跳转类型
        chooseJumpType = function(val) {
            if ((isHidePath && isManage == 0) ||  ("${task.executionId}"=="" && "${task.description}"=='15')){
                return;
            }
            var obj = $('#jumpDiv');
            var url = "";
            //正常跳转
            if (val == 1) {
                url= serverPath.qbdmsPath + setter.workflowLinkPath + "task/view/tranTaskUserMap?taskId=${task.id}&selectPath=0";
            }
            //选择路径跳转
            else if (val == 2) {
                url=serverPath.qbdmsPath + setter.workflowLinkPath + "task/view/tranTaskUserMap?taskId=${task.id}";
            }
            //自由跳转
            else if (val == 3) {
                url=serverPath.qbdmsPath + setter.workflowLinkPath + "task/freeJump?taskId=${task.id}";
            }

            if (val == 3) {  //自由跳转
                $.ajaxSetup({async: false});  //同步 获得结果后  再去查询相关的人员
                obj.html(obj.attr("tipInfo")).show().load(url);
                $.ajaxSetup({async: true}); //异步
            } else {
                obj.html(obj.attr("tipInfo")).show().load(url);
            }
        };

        //更改目标任务
        changeDestTask = function (sel) {
            var nodeId = sel.value;
            if (typeof nodeId == 'undefined') {    //对象不是用原始JS的，而是通过Jquery获取的对象
                nodeId = sel.val();
            }
            if (typeof nodeId == 'undefined' || nodeId == null || nodeId == "") {
                $('#jumpUserDiv').html("");
                $('#lastDestTaskId').val("");
                return;
            }
            $('#lastDestTaskId').val(nodeId);
            var url = serverPath.qbdmsPath + setter.workflowLinkPath + "task/getTaskUsers?taskId=${task.id}&nodeId=" + nodeId;
            $.getJSON(url, function (result) {
                var data = eval(result.data);
                var aryHtml = [];
                for (var i = 0; i < data.length; i++) {
                    var span = "<input type='checkbox' include='1' name='" + nodeId + "_userId' checked value='" + data[i].type + "^" + data[i].executeId + "^" + data[i].executor + "' lay-skin='primary' title='"+data[i].executor+"'/>";
                    aryHtml.push(span);
                }
                $('#jumpUserDiv').html(aryHtml.join(''));
                form.render();
            });
        };

        //选择常用语
        form.on('select(selTaskAppItem)', function(data){
            var selectedValue = data.value;
            $("#voteContent").val(selectedValue);
        });

        initForm();
        //显示路径
        if (isHandChoose) {
            chooseJumpType(2);
        } else {
            chooseJumpType(1);
        }
        if(isPopup==1 || isHideOption == 1){
            $("#opinionDiv").hide();
        }
        //设置表单。
        function initForm(){
            if(isFormEmpty) return;
            if(isExtForm){
                //url表单
                var formKey=$('#divExternalForm').attr("formUrl");
                var data = {
                    formKey: formKey,
                    procDefId:"${procDefId}",
                    businessKey:"${processRun.businessKey}",
                    nodeId:nodeId,
                    parentProcDefId:"${parentProcDefId}"
                };

                $.ajax({
                    type:"post",
                    url:serverPath.qbdmsPath  + setter.workflowLinkPath + "task/addPermissionToUrlForm",
                    data:data,
                    dataType:"json",
                    success:function (result) {
                        var html = result.data;
                        $("#divExternalForm").append(html);
                    }
                });
            }else{
                $("#customFormDiv").load(serverPath.qbdmsPath + '${form}');
            }
        };


        //获取是否允许直接结束。
        function getIsDirectComplete() {
            var isDirectComlete = false;
            if ($("#chkDirectComplete").length > 0) {
                if ($("#chkDirectComplete").prop("checked")) {
                    isDirectComlete = true;
                }
            }
            return isDirectComlete;
        }


        //处理意见框的附件
        function handleOpinionAttachment(data){
            var json = [];
            $("#attachmentList li").each(function () {
                json.push({
                    id:$(this).attr("fileId"),
                    name:$(this).find('span').html()
                });
            });
            if(json.length>0){
                data.field.attachment=JSON.stringify(json);
            }
        }

        // 在完成任务之前，加上判断是否需要弹出意见对话框
        function completeTaskBefore(data) {
            //2020.03.09新增逻辑:  驳回操作时必须填写审批意见
            if ((data.field.voteAgree==3 && isHideOption == 1 )|| isPopup == 1) {
                opintionDialog(data);
            } else {
                handleOpinionAttachment(data)
                completeTask(data);
            }
        }

        //设置表单数据
        function setFormData(data){
            if (isExtForm) {
                var checkBoxObject = new Object();
                $("#divExternalForm form input[type='checkbox']").each(function(){
                    var b = $(this).next().hasClass("layui-form-checked");
                    if(b){
                        if(!checkBoxObject[$(this).prop("name")]){
                            checkBoxObject[$(this).prop("name")] =$(this).val();
                        }else{
                            checkBoxObject[$(this).prop("name")] +=","+$(this).val();
                        }
                    }
                });
                for (var item in checkBoxObject){
                    data.field[item]=checkBoxObject[item];
                }
            }else{
                data.field.formData = getData();
            }
        }

        /**
         * ajax提交
         * @param url
         * @param data
         */
        function ajaxSubmit(url,data){
            var loadShade = layer.load(1, {
                shade: [0.3, '#ccc'] //0.1透明度的白色背景
            });
            $.ajax({
                url:url,
                dataType: 'json',
                type: "POST",
                data:data,
                success:function (result) {
                    layer.close(loadShade);//关闭layer.load
                    showResponse(result,operatorType);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.close(loadShade);//关闭layer.load
                    layer.alert("操作失败！" + XMLHttpRequest.status);
                }
            });
        }

        // 处理返回信息
        function showResponse(result,type) {
            if (result.code === 0) {
                layer.alert(publicMethods.confirmStyle(result.msg),{title: false,skin: 'confirm-class'},function(index){
                    layer.close(index);
                    layer.close(opinionDialogIndex);
                    //后置事件处理
                    var rtn=afterClick(type);
                    if(rtn!=false) {
                        if(type == 16){
                            window.close();
                        } else if (top.location != self.location) {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));
                        } else {
                            window.close();
                        }
                    }
                });
            } else {
                var msg = result.msg;
                if(result.data!="" && result.data!=null){
                    msg+="失败原因:"+result.data;
                }
                layer.alert(publicMethods.confirmStyle(msg),{title: false,skin: 'confirm-class'});
            }
        }

        // 弹出意见对话框
        function opintionDialog(data) {
            opinionDialogIndex = layer.open({
                type: 1,
                title: "审批意见",
                area: ['550px',opinionDialogH],
                content: $('#opinionDiv'),
                skin: 'btn-class',
                btn: ['保存','取消'],
                btnAlign: 'c',
                yes: function(index,layero){
                    data.field.voteContent=$("#voteContent").val();
                    if(operatorType == 12){
                        data.field.backNodeIds = $("input[name=backNodeIds]").val();
                    }
                    handleOpinionAttachment(data);
                    completeTask(data);
                }
            });
        }

        //获取消息类型
        function  getInformTypes(element){
            var informTypes = [];
            element.each(function (index,element) {
                informTypes.push($(element).val());
            });
            return informTypes.toString();
        }

        //完成当前任务。
        function completeTask(data) {
            if(data.field.voteAgree == 3) {
                isRequired = '1';
            }

            if(isRequired=="1" && (data.field.voteContent===undefined || data.field.voteContent==="")){
                layer.msg("请输入审批意见！", {icon: 0, time: 1000});
                return;
            }
            //执行前置脚本
            var rtn = beforeClick(operatorType);
            if (rtn == false) {
                return;
            }
            setFormData(data);
            var url = serverPath.qbdmsPath + setter.workflowLinkPath+"task/complete";
            ajaxSubmit(url,data.field);
        }

        selectExeUsers = function(obj) {
            var destTask = $("#destTask");
            if (destTask!="undefined") {
                $("#lastDestTaskId").val(destTask.val());
            }
            selExeUsers(obj, destTask.val());
        };

        //选择执行人员
        selExeUsers = function(obj,nodeId){
            var userSelectorWin;
            var body;
            var span = $(obj).parent().siblings("span");
            var selectUsers = [];
            var selectOthers = [];

            if (isFirstNode) {
                dataPrivacyLevel = $("select[name^='m:'][name$='dataPrivacyLevel']").val();
            }
            $(span).find('.layui-form-checked').each(function (i,item) {
                var val=$(item).prev().val();
                var array = val.split("^");
                var selectUser={
                    type:array[0],
                    id:array[1],
                    name:array[2]
                };
                if(selectUser.type==="user"){
                    //类别为用户
                    selectUsers.push(selectUser);
                }else{
                    selectOthers.push(selectUser);
                }
            });
            layer.open({
                type: 2,
                title: "人员选择器",
                resize: false,
                area: ['980px', '630px'],
                btn:["保存","取消","撤销"],
                content: serverPath.qbdmsPath + setter.sysLinkPath + "dialog/view/sysUserDialog?dataPrivacyLevel="+ dataPrivacyLevel,  // todo 添加密级条件
                success: function(layero, index){
                    body = layer.getChildFrame('body',index);
                    userSelectorWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                    userSelectorWin.layui.userList=[];
                    if(selectUsers.length>0){
                        for(var i=0;i<selectUsers.length;i++){
                            userSelectorWin.layui.userList.push({name:selectUsers[i].name,userId:selectUsers[i].id});
                        }
                    }
                },
                yes:function(index, layero){
                    var aryTmp = [];
                    //用户选择器返回的选择人员数组[{name:"name1",userId:"userId1"},{name:"name2",userId:"userId2"}...]
                    var theUserList = body.find("input[name=userList]").val();
                    if(theUserList){
                        layui.each(JSON.parse(theUserList),function(index,item){
                            var html = "&nbsp;&nbsp;<input type=\"checkbox\" name=\""+nodeId+"_userId["+item.userId+"]\"  value=\"user^"+item.userId+"^"+item.name+"\" lay-skin=\"primary\" checked=\"checked\"/>"+item.name;
                            aryTmp.push(html);
                        });
                    }

                    if(selectOthers.length>0){
                        for(var i=0;i<selectOthers.length;i++){
                            var html = "&nbsp;&nbsp;<input type=\"checkbox\" name=\""+nodeId+"_userId["+selectOthers[i].id+"]\"  value=\""+selectOthers[i].type+"^"+selectOthers[i].id+"^"+selectOthers[i].name+"\" lay-skin=\"primary\" checked=\"checked\"/>"+selectOthers[i].name;
                            aryTmp.push(html);
                        }
                    }
                    span.html(aryTmp.join(''));
                    form.render('checkbox');
                    layer.close(index);
                },
                btn3:function (index, layero) {
                    userSelectorWin.cancelData(index);
                    return false;
                }
            });
        };

        //选择接收人,转发代办的接收人
        $("#windowUserChoose").click(function () {
            var userSelectorWin;
            var body;
            var that = $("#assigned table [name='title']");
            var thatHidden = $("#assigned table [name='titleHidden']");
            if (isFirstNode) {
                dataPrivacyLevel = $("select[name^='m:'][name$='dataPrivacyLevel']").val();
            }
            layer.open({
                type:2
                ,title:'人员选择器'
                ,area:['980px','630px']
                ,btn:["保存","取消","撤销"]
                ,resize:false
                ,content: serverPath.qbdmsPath + setter.sysLinkPath+'dialog/view/singleSysUserDialog?dataPrivacyLevel='+ dataPrivacyLevel  // todo 添加密级条件
                ,success: function(layero, index){
                    body = layer.getChildFrame('body',index);
                    userSelectorWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                }
                ,yes:function(index, layero){
                    //执行iframe页的save方法
                    userSelectorWin.saveData(index);
                    var theUserList = body.find("input[name=selectUser]").val();
                    if (theUserList) {
                        var item = JSON.parse(theUserList);
                        var itemId  = item.userId;//用户ID
                        var itemName= item.fullName;//用户姓名
                        that.attr("value",itemName);
                        thatHidden.attr("value",itemId);
                        layer.close(index);
                    }
                },
                btn3:function (index, layero) {
                    userSelectorWin.cancelData(index);
                    return false //开启该代码可禁止点击该按钮关闭
                }
            });
        });
        //沟通人员的选择器
        $("#selectUser").click(function () {
            var that = $("#communicationDiv table [name='title']");
            var thatHidden = $("#communicationDiv table [name='titleHidden']");
            openUserSelectDialog(that, thatHidden);
        });

        //任务补签的人员选择器
        $("#selectAddSignUser").click(function () {
            var that = $("#retoActiveDiv table [name='title']");
            var thatHidden = $("#retoActiveDiv table [name='titleHidden']");
            openUserSelectDialog(that, thatHidden);
        });

        function openUserSelectDialog(that, thatHidden){
            var body;
            var userSelectorWin;
            if (isFirstNode) {
                dataPrivacyLevel = $("select[name^='m:'][name$='dataPrivacyLevel']").val();
            }
            layer.open({
                type: 2,
                title: '人员选择器',
                area: ['980px', '630px'],
                btn:["保存","取消","撤销"],
                resize: false,
                content:serverPath.qbdmsPath + setter.sysLinkPath+ "dialog/view/sysUserDialog?dataPrivacyLevel="+ dataPrivacyLevel,    // todo 添加密级条件
                success: function (layero, index) {
                    body = layer.getChildFrame('body',index);
                    userSelectorWin = window[layero.find('iframe')[0]['name']];
                    userSelectorWin.layui.userList = [];
                    if (that != null && that.val()) {
                        var hiddenDataArr = thatHidden.val().split(",");
                        var theDataArr = that.val().split(",");
                        $.each(hiddenDataArr,function (k,v) {
                            var userListObj={};
                            userListObj.name = theDataArr[k];
                            userListObj.userId = v;
                            userSelectorWin.layui.userList.push(userListObj);
                        })
                    }
                },
                yes: function (index, layero) {
                    var itemId="";
                    var itemName="";
                    var theUserList = body.find("input[name=userList]").val();
                    if(theUserList){
                        layui.each(JSON.parse(theUserList), function (index, item) {
                            itemId  += item.userId+",";
                            itemName += item.name+",";
                        });
                    }
                    if (itemName.length > 0) {
                        //用户ID
                        thatHidden.val( itemId.substr(0, itemId.length - 1) );
                        //用户姓名
                        that.val( itemName.substr( 0, itemName.length - 1) );
                    }
                    layer.close(index);
                },
                btn3: function (index, layero) {
                    userSelectorWin.cancelData(index);
                    return false //开启该代码可禁止点击该按钮关闭
                }
            });
        }

        form.on('radio(jumpType)', function(data){
            chooseJumpType(data.value);
        });


        //选择加签流转人
        chooseTransUsers = function(){
            var cmpIds = $("#cmpIds").val();
            var cmpNames = $("#cmpNames").html();
            var userSelectorWin;
            var body;
            if (isFirstNode) {
                dataPrivacyLevel = $("select[name^='m:'][name$='dataPrivacyLevel']").val();
            }
            layer.open({
                type: 2,
                title: '人员选择器',
                area: ['980px','600px'],
                btn:["保存","取消","撤销"],
                resize:false,
                content:serverPath.qbdmsPath + setter.sysLinkPath+ "dialog/view/sysUserDialog?dataPrivacyLevel="+ dataPrivacyLevel, // todo 添加密级条件
                success: function(layero, index){
                    body = layer.getChildFrame('body',index);
                    userSelectorWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                    userSelectorWin.layui.userList=[];
                    if(cmpIds!=""){
                        var cmpIdAry = cmpIds.split(',');
                        var cmpNameAry = cmpNames.split(',');
                        for(var i=0;i<cmpIdAry.length;i++){
                            userSelectorWin.layui.userList.push({name:cmpNameAry[i],userId:cmpIdAry[i]});
                        }
                    }
                },
                yes: function(index, layero){
                    var cmpIdAry =[];
                    var cmpNameAry =[];
                    var theUserList = body.find("input[name=userList]").val();
                    if(theUserList){
                        layui.each(JSON.parse(theUserList),function(index,item){
                            if(curUserId===item.userId){
                                layer.msg('流转人员不能包含自己,已过滤！',{icon: 5});
                                return;
                            }
                            cmpIdAry.push(item.userId);
                            cmpNameAry.push(item.name);
                        });
                        $("#cmpIds").val(cmpIdAry.join(','));
                        $("#cmpNames").html(cmpNameAry.join(','));
                    }else{
                        $("#cmpIds").val('');
                        $("#cmpNames").html('');
                    }
                    layer.close(index);
                },
                btn3:function(index, layero){
                    userSelectorWin.cancelData(index);
                    return false //开启该代码可禁止点击该按钮关闭
                }
            });
        };

        // 自由回退选择节点
        $(".selectFreeBackNodes").click(function () {
            var body;
            var nodeSelectorWin;
            var nodeIds = $("input[name=backNodeIds]").val();
            var nodeNames = $("#backNodes").val();
            layer.open({
                type: 2,
                title: '节点选择器',
                area: ['900px', '620px'],
                btn: ["保存", "取消", "撤销"],
                resize: false,
                content: serverPath.qbdmsPath + setter.workflowLinkPath + "task/view/freeBackByFlowImg?taskId=${task.id}&procInstId=${procInstId}&runId="+runId,
                success: function (layero, index) {
                    body = layer.getChildFrame('body',index);
                    nodeSelectorWin = window[layero.find('iframe')[0]['name']];
                    nodeSelectorWin.layui.elementList=[];
                    if(nodeIds!=""){
                        var cmpIdAry = nodeIds.split(',');
                        var cmpNameAry = nodeNames.split(',');
                        for(var i=0;i<cmpIdAry.length;i++){
                            nodeSelectorWin.layui.elementList.push({name :cmpNameAry[i],id:cmpIdAry[i]});
                        }
                    }
                },
                yes: function (index, layero) {
                    var cmpIdAry =[];
                    var cmpNameAry =[];
                    var theNodeList = body.find("input[name=elementList]").val();
                    if(theNodeList){
                        layui.each(JSON.parse(theNodeList),function(index,item){
                            if(curUserId===item.userId){
                                layer.msg('流转人员不能包含自己,已过滤！',{icon: 5});
                                return;
                            }
                            cmpIdAry.push(item.id);
                            cmpNameAry.push(item.name);
                        });
                        $("input[name=backNodeIds]").val(cmpIdAry.join(','));
                        $("#backNodes").val(cmpNameAry.join(','));
                    }else{
                        $("input[name=backNodeIds]").val('');
                        $("#backNodes").val('');
                    }
                    layer.close(index);
                },
                btn3: function (index, layero) {
                    nodeSelectorWin.cancelData(index);
                    return false //开启该代码可禁止点击该按钮关闭
                }
            });
        });
        //------------------按钮操作-开始------------------//

        //同意
        form.on('submit(agree)', function(data){
            $("#selectNodeDiv").addClass("layui-hide");
            //是否允许直接结束
            var isDirectComlete = getIsDirectComplete();
            operatorType = 1;
            //同意:5，一票通过。
            var tmp = isDirectComlete ? "5" : "1";
            data.field.voteAgree=tmp;
            data.field.back="0";

            //选择路径跳转节点
            var destTaskValue = $("input[name='destTask']:checked").val();
            var isChecked = false;
            if (destTaskValue != null) {
                var inputSelectUser = $("input[name^=" + destTaskValue + "_userId]");
                for (var i = 0; i < inputSelectUser.length; i++) {
                    if (inputSelectUser.get(i).checked) {
                        isChecked = true;
                    }
                }
            } else {
                var optLabel = $('#destTask option:selected').parent().attr('label');
                if (optLabel != null) {
                    //自由跳转情况(只需要考虑任务节点)
                    if (optLabel == "任务节点") {
                        var lastDestTaskIds = $("input[name='lastDestTaskId']");
                        if (lastDestTaskIds.length != 0) {
                            for (var j = 0; j < lastDestTaskIds.length; j++) {
                                var lastDestTaskUser = lastDestTaskIds.val() + "_userId"
                                var inputSelectUser = $("input[name^=" + lastDestTaskUser + "]");
                                for (var k = 0; k < inputSelectUser.length; k++) {
                                    if (inputSelectUser.get(k).checked) {
                                        isChecked = true;
                                    }
                                }
                            }
                        }
                    } else {
                        isChecked = true;
                    }
                } else {
                    //正常跳转
                    var lastDestTaskIds = $("input[name^='lastDestTaskId']");
                    if (lastDestTaskIds.length != 0) {
                        for (var j = 0; j < lastDestTaskIds.length; j++) {
                            var lastDestTaskUser = lastDestTaskIds.get(j).value + "_userId";
                            var inputSelectUser = $("input[name^=" + lastDestTaskUser + "]");
                            var hasChecked = false;
                            for (var k = 0; k < inputSelectUser.length; k++) {
                                if (inputSelectUser.get(k).checked) {
                                    hasChecked = true;
                                    break;
                                }
                            }
                            isChecked = hasChecked;
                            if(isChecked){
                                break;
                            }
                        }
                    } else {
                        isChecked = true;
                    }
                }
            }
            if (!isChecked) {
                //没有设置下一节点的执行人；
                layer.msg('没有设置下一节点的执行人!', {icon: 5});
                return false;
            }

            completeTaskBefore(data);
            return false;
        });

        // 会签反对
        form.on('submit(against)', function (data) {
            $("#selectNodeDiv").addClass("layui-hide");
            //是否允许直接结束
            var isDirectComlete = getIsDirectComplete();
            operatorType = 2;
            // 直接一票通过
            var tmp = isDirectComlete ? '6' : '2';
            data.field.voteAgree=tmp;
            data.field.back="0";
            completeTaskBefore(data);
            return false;

        });

        // 会签弃权
        form.on('submit(abandon)', function (data) {
            $("#selectNodeDiv").addClass("layui-hide");
            operatorType = 3;
            data.field.voteAgree='0';
            data.field.back="0";
            completeTaskBefore(data);
            return false;
        });

        // 会签补签
        $(".retoActive").click(function () {
            operatorType = 7;
            opinionDialogIndex = layer.open({
                type: 1,
                title: "任务补签窗口",
                area: ['460px','380px'],
                content: $('#retoActiveDiv'),
                skin: 'btn-class',
                btn: ['补签','关闭'],
                btnAlign: 'c',
                yes: function(index,layero){
                    //接收人
                    var userIds  =   $("#retoActiveDiv table [name='titleHidden']").val();
                    //消息通知
                    var informTypeElement=$("#retoActiveDiv table [name='informType']:checked");
                    var informType = getInformTypes(informTypeElement);
                    //审批原因
                    var opinion  =   $("#retoActiveDiv table [name='addSignReason']").val();

                    if(userIds.length<=0 ||userIds.length<=0){
                        layer.msg("请选择有效的补签人信息",{icon:5,time:1000});
                        return ;
                    }
                    if(opinion.length<=0){
                        layer.msg("请输入补签原因",{icon:5,time:1000});
                        return ;
                    }
                    //沟通按钮没有前后置脚本执行
                    $.ajax({
                        url:serverPath.qbdmsPath + setter.workflowLinkPath+"task/addSign",
                        method: "POST",
                        dataType: 'json',
                        data:{
                            taskId:$("#taskId").val(),
                            signUserIds:userIds,
                            informType:informType,
                            opinion:opinion
                        },
                        success:function (result) {
                            if (result.code === 0) {
                                layer.alert(result.msg,function(index){
                                    layer.close(index);
                                    layer.close(opinionDialogIndex);
                                });
                            } else {
                                layer.alert(result.msg);
                            }
                        }
                        ,error:function (res) {
                        }
                    });
                },end: function (index) {
                    layer.closeAll('iframe');
                }
            });
        });

        //保存表单
        form.on('submit(save)', function(data){
            operatorType = 8;
            var rtn = beforeClick(operatorType);
            if (rtn == false) {
                return;
            }
            setFormData(data);
            var url = serverPath.qbdmsPath + setter.workflowLinkPath+"task/saveFlowData";
            ajaxSubmit(url,data.field);
        });

        //驳回
        form.on('submit(reject)', function(data){
            $("#selectNodeDiv").addClass("layui-hide");
            operatorType = 4;
            data.field.voteAgree="3";
            data.field.back="1";
            completeTaskBefore(data);
            return false;
        });

        // 自由回退
        form.on('submit(freeBack)', function (data) {
            $("#selectNodeDiv").removeClass("layui-hide");
            operatorType = 12;
            data.field.voteAgree="3";
            data.field.back="4";
            completeTaskBefore(data);
            return false;
        });

        //驳回到发起人
        form.on('submit(rejectToStart)', function(data){
            $("#selectNodeDiv").addClass("layui-hide");
            operatorType = 5;
            data.field.voteAgree="3";
            data.field.back="2";
            completeTaskBefore(data);
            return false;
        });

        //转交代办
        $(".goForward").click(function () {
            operatorType = 6;
            opinionDialogIndex = layer.open({
                type: 1,
                title: "转交代办",
                area: ['460px','380px'],
                content: $('#assigned'),
                skin: 'btn-class',
                btn: ['确定','取消'],
                btnAlign: 'c',
                yes: function(index,layero){
                    //接收人
                    var assigneeId  =   $("#assigned table [name='titleHidden']").val();
                    var assigneeName=   $("#assigned table [name='title']").val();
                    //消息通知
                    var informTypeElement  =   $("#assigned table [name='informType']:checked");
                    var informType = getInformTypes(informTypeElement);
                    //审批原因
                    var memo  =   $("#assigned table [name='memo']").val();

                    if(assigneeId.length<=0 ||assigneeName.length<=0){
                        layer.msg("请选择有效的接收人信息",{icon:5,time:1000});
                        return ;
                    }
                    if(memo.length<=0){
                        layer.msg("请输入转办原因",{icon:5,time:1000});
                        return ;
                    }
                    //执行前置脚本
                    var rtn = beforeClick(operatorType);
                    if (rtn == false) {
                        return;
                    }
                    $.ajax({
                        url:serverPath.qbdmsPath + setter.workflowLinkPath+"bpmTaskExe/assignSave",
                        dataType: 'json',
                        method: "POST",
                        data:{
                            taskId:$("#taskId").val(),
                            assigneeId:assigneeId,
                            assigneeName:assigneeName,
                            informType:informType,
                            memo:memo
                        },
                        success:function (result) {
                            showResponse(result,operatorType);
                        }
                    });
                },end: function (index) {
                    layer.closeAll('iframe');
                }
            });
        });

        //沟通
        $(".communication").click(function () {
            operatorType = 16;
            opinionDialogIndex = layer.open({
                type: 1,
                title: "沟通意见",
                area: ['500px','400px'],
                content: $('#communicationDiv'),
                skin: 'btn-class',
                btn: ['确定','取消'],
                btnAlign: 'c',
                yes: function(index,layero){
                    //接收人
                    var userIds  =   $("#communicationDiv table [name='titleHidden']").val();
                    //消息通知
                    var informTypeElement=$("#communicationDiv table [name='informType']:checked");
                    var informType = getInformTypes(informTypeElement);
                    //审批原因
                    var memo  =   $("#communicationDiv table [name='memo']").val();

                    if(userIds.length<=0 ||userIds.length<=0){
                        layer.msg("请选择有效的沟通人信息",{icon:5,time:1000});
                        return ;
                    }
                    if(memo.length<=0){
                        layer.msg("请输入沟通内容",{icon:5,time:1000});
                        return ;
                    }
                    //沟通按钮没有前后置脚本执行
                    $.ajax({
                        url:serverPath.qbdmsPath + setter.workflowLinkPath+"task/toStartCommunication",
                        method: "POST",
                        dataType: 'json',
                        data:{
                            taskId:$("#taskId").val(),
                            userIds:userIds,
                            informType:informType,
                            opinion:memo
                        },
                        success:function (result) {
                            showResponse(result,operatorType);
                        }
                        ,error:function (res) {
                        }
                    });
                },end: function (index) {
                    layer.closeAll('iframe');
//                    layer.close(opinionDialogIndex);
                }
            });
        });

        //反馈
        $(".feedbackOpinions").click(function () {
            opinionDialogIndex = layer.open({
                type: 1,
                title: "沟通反馈",
                area: ['500px','311px'],
                content: $('#feedbackOpinionsDiv'),
                skin: 'btn-class',
                btn: ['确定','取消'],
                btnAlign: 'c',
                yes: function(index,layero){
                    //消息通知
                    var informTypeElement=$("#feedbackOpinionsDiv table [name='informType']:checked");
                    var informType = getInformTypes(informTypeElement);
                    //审批原因
                    var memo  =   $("#feedbackOpinionsDiv table [name='memo']").val();

                    if(memo.length<=0){
                        layer.msg("请输入反馈意见",{icon:5,time:1000});
                        return ;
                    }
                    //反馈按钮没有前后置脚本执行
                    $.ajax({
                        url:serverPath.qbdmsPath + setter.workflowLinkPath+"task/toStartFeedbackOpinions",
                        dataType: 'json',
                        type: "POST",
                        data:{
                            taskId:$("#taskId").val(),
                            informType:informType,
                            opinion:memo
                        },
                        success:function (result) {
                            if (result.code === 0) {
                                layer.alert(result.msg,function(index){
                                    layer.close(index);
                                    layer.close(opinionDialogIndex);
                                    if (top.location != self.location) {
                                        parent.layer.close(parent.layer.getFrameIndex(window.name));
                                    } else {
                                        window.close();
                                    }
                                });
                            } else {
                                layer.alert(result.msg);
                            }
                        }
                    });
                },end: function (index) {
                    layer.closeAll('iframe');
                }
            });
        });

        //加签反馈
        $(".transFeedbackOpinions").click(function () {
            layer.open({
                type: 1,
                title: "加签反馈",
                area: ['500px','311px'],
                content: $('#feedbackOpinionsDiv'),
                skin: 'btn-class trans',
                btn: ['同意','反对','取消'],
                btnAlign: 'c',
                yes: function(index,layero){
                    sendTransFeedbackOpinions(true);
                },
                btn2: function(index, layero){
                    sendTransFeedbackOpinions(false);
                    return false;
                },
                btn3: function(index, layero){
                    //取消
                }
            });
        });

        function sendTransFeedbackOpinions(isAgree){
            var action="";
            if(isAgree){
                action="同意";
            }else{
                action="反对";
            }
            layer.confirm('确定['+action+']操作？', function(index){
                layer.close(index);
                //消息通知
                var informTypeElement=$("#feedbackOpinionsDiv table [name='informType']:checked");
                var informType = getInformTypes(informTypeElement);
                //审批原因
                var memo  =   $("#feedbackOpinionsDiv table [name='memo']").val();
                if(memo.length<=0){
                    layer.msg("请输入反馈意见",{icon:5,time:1000});
                    return ;
                }
                var businessKey = $("#businessKey").val();
                var params = {
                    isAgree:isAgree,
                    opinion:memo,
                    informType:informType,
                    taskId:$("#taskId").val(),
                    businessKey:businessKey
                };
                if(!isExtForm){
                    var formData = getData();
                    params['formData']=formData;
                }
                $.ajax({
                    url:serverPath.qbdmsPath + setter.workflowLinkPath+"task/toStartFeedbackOpinions",
                    dataType: 'json',
                    type: "POST",
                    data:params,
                    success:function (data) {
                        if(publicMethods._filterRecord(data)){
                            layer.alert(data.msg, function (index) {
                                layer.close(index);
                                if (top.location != self.location) {
                                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                                } else {
                                    window.close();
                                }
                            });
                        }else{
                            layer.msg(data.msg, {icon:5});
                        }
                    }
                });
            });
        }


        //流程图

        var processInstanceId="${procInstId}";
        bpmImageShow(processInstanceId,"",setter);
        function bpmImageShow(procInstId,runId,setter) {
            $(".flowChart").click(function () {
                parent.layer.open({
                    type: 2,
                    title: "流程图",
                    shade: 0.3,
                    left: 200,
                    area: ['1000px', '600px'],
                    content:serverPath.qbdmsPath+setter.workflowLinkPath+"processRun/view/bpmImg?procInstId="+procInstId+"&runId="+runId,
                    btn:['','关闭'],
                    success:function (layero,index) {
                        $(layero).find("a.layui-layer-btn0").hide();
                    }
                });
            });
        }
        //返回
        $(".close").click(function () {
            layer.close(opinionDialogIndex);
        });

        // 终止
        $(".endProcess").click(function () {
            var taskId = $("#taskId").val();
            layer.open({
                type: 2
                , title: "终止"
                , area: ['450px', '238px']
                , content: serverPath.qbdmsPath + setter.workflowLinkPath + "task/view/endProcess?taskId=" + taskId
            });
        });

        //审批历史
        $(".taskOpinions").click(function () {
            layer.open({
                type: 2,
                title: "审批历史",
                area: ['1200px','585px'],
                content: serverPath.qbdmsPath + setter.workflowLinkPath +"taskOpinion/view/list?runId=" + runId
            });
        });

        //流程参考
        $(".reference").click(function () {
            var url =  serverPath.qbdmsPath + setter.workflowLinkPath+"task/view/getRefList?modelId=${actDefModel.id!}"
            window.open(url);
        });

        //加签
        $(".addTransTo").click(function () {
            $.ajax({
                url: serverPath.qbdmsPath + setter.workflowLinkPath + "task/isTaskExsit?taskId=" + $("#taskId").val(),
                type: "post",
                dataType: 'json',
                success: function (data) {
                    if (data.code == 0) {
                        layer.open({
                            type:1,
                            title:"加签",
                            area: ['800px','600px'],
                            content: $('#addTransToDiv'),
                            skin: 'btn-class',
                            btn: ['确定','取消'],
                            btnAlign: 'c',
                            yes: function(index,layero){
                                var cmpIds=$("#cmpIds").val();
                                if(cmpIds==""){
                                    layer.msg('请添加用户！',{icon: 5});
                                    return;
                                }
                                //会签类型
                                var transType=$("input[name='transType']:checked").val();
                                var cmpIdAry = cmpIds.split(",");
                                if(transType=='2' && cmpIdAry.length<=1){
                                    layer.msg('会签类型的人数必须大于1！',{icon: 5});
                                    return;
                                }
                                layer.confirm('确定发送流转意见？', function(index) {
                                    var transOpinion=$("#transOpinion").val();
                                    var action=$("input[name='action']:checked").val();
                                    //消息通知
                                    var informTypeElement=$("#addTransToDiv table [name='informType']:checked");
                                    var informType = getInformTypes(informTypeElement);
                                    var taskId = $("#taskId").val();
                                    var businessKey = $("#businessKey").val();
                                    var params= {cmpIds:cmpIds,
                                        opinion:transOpinion,
                                        transType:transType,
                                        action:action,
                                        informType:informType,
                                        taskId:taskId,
                                        businessKey:businessKey};
                                    if(!isExtForm){
                                        var formData = getData();
                                        params['formData']=formData;
                                    }
                                    var url=serverPath.qbdmsPath + setter.workflowLinkPath+"task/toStartTransTo";
                                    $.post(url,params,function(data){
                                        if(publicMethods._filterRecord(data)){
                                            layer.alert(data.msg, function (index) {
                                                layer.close(index);
                                                if (top.location != self.location) {
                                                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                                                } else {
                                                    window.close();
                                                }
                                            });
                                        }else{
                                            layer.msg(data.msg, {icon:5});
                                        }
                                    },'json');
                                });
                            },end: function (index) {
                            }

                        });
                    } else {
                        layer.alert("这个任务已经完成或被终止了!");
                    }
                },
                error: function (XMLHttpRequest) {
                    layer.alert("操作失败！" + XMLHttpRequest.status);
                }
            });
        });

        //------------------按钮操作-结束------------------//
    });
</script>

<!--转发代办-->
<div id="assigned" style="margin: 10px;display:none;">
    <form class="layui-form" action="" >
        <table class="layui-table">
            <tr>
                <td>接收人:</td>
                <td>
                    <input type="hidden" name="titleHidden" readonly  >
                    <input type="text" name="title" readonly  autocomplete="off" placeholder="请输入接收人" class="layui-input" style="width: 70%;display: inline">
                    <button type="button" class="layui-btn layui-btn-sm" id="windowUserChoose">选择</button>
                </td>
            </tr>
            <tr>
                <td>提醒消息方式:</td>
                <td>
                    <!--通知方式-->
                    <div class="layui-input-inline">
                        <#list handlersMap?keys as key>
                        <input type="checkbox" class="layui-input" lay-filter="informType" name="informType" lay-skin="primary" value="${key}"
                            checked="checked"  />
                        <span style="line-height: 44px;">
                            ${handlersMap[key].title }
                        </span>
                        </#list>
                    </div>
                </td>
            </tr>
            <tr>
                <td>转办原因:</td>
                <td><textarea  name="memo" placeholder="请输入转办原因" class="layui-textarea"></textarea></td>
            </tr>
        </table>
    </form>
</div>

<!--任务补签-->
<div id="retoActiveDiv" style="margin: 20px;display:none;">
    <form class="layui-form" action="">
        <table class="layui-table">
            <tr>
                <td>选择补签人员:</td>
                <td>
                    <input type="hidden" name="titleHidden" readonly  >
                    <!--TODO 选择用户过多，名称展示不全-->
                    <input type="text" name="title" readonly  autocomplete="off" placeholder="请选择补签人员" class="layui-input" style="width: 70%;display: inline">
                    <button type="button" class="layui-btn layui-btn-sm" id="selectAddSignUser">选择</button>
                </td>
            </tr>
            <tr>
                <td>提醒消息方式:</td>
                <td>
                    <!--通知方式-->
                    <div class="layui-input-inline">
                        <#list handlersMap?keys as key>
                        <input type="checkbox" class="layui-input" lay-filter="informType" name="informType" lay-skin="primary" value="${key}" checked="checked"  />
                        <span style="line-height: 44px;">
                            ${handlersMap[key].title }
                        </span>
                    </#list>
                    </div>
                </td>
            </tr>
            <tr>
                <td>补签原因:</td>
                <td><textarea  name="addSignReason" placeholder="请输入补签原因" class="layui-textarea"></textarea></td>
            </tr>
        </table>
    </form>
</div>
<!--沟通意见-->
<div id="communicationDiv" style="margin: 20px;display:none;">
    <form class="layui-form" action="">
        <table class="layui-table">
            <tr>
                <td>沟通人员:</td>
                <td>
                    <input type="hidden" name="titleHidden" readonly  >
                    <input type="text" name="title" readonly  autocomplete="off" placeholder="请选择沟通人员" class="layui-input" style="width: 70%;display: inline">
                    <button type="button" class="layui-btn layui-btn-sm" id="selectUser">选择</button>
                </td>
            </tr>
            <tr>
                <td>提醒消息方式:</td>
                <td>
                    <!--通知方式-->
                    <div class="layui-input-inline">
                        <#list handlersMap?keys as key>
                        <input type="checkbox" class="layui-input" lay-filter="informType" name="informType" lay-skin="primary" value="${key}" checked="checked"  />
                        <span style="line-height: 44px;">
                            ${handlersMap[key].title }
                        </span>
                    </#list>
                    </div>
                </td>
            </tr>
            <tr>
                <td>沟通内容:</td>
                <td><textarea  name="memo" placeholder="请输入沟通内容" class="layui-textarea"></textarea></td>
            </tr>
        </table>
    </form>
</div>
<!--抄送人员，反馈-->
<div id="feedbackOpinionsDiv" style="margin: 10px;display:none;">
    <form class="layui-form" action="">
        <table class="layui-table">
            <tr>
                <td>提醒消息方式:</td>
                <td>
                    <!--通知方式-->
                    <div class="layui-input-inline">
                        <#list handlersMap?keys as key>
                        <input type="checkbox" class="layui-input" lay-filter="informType" name="informType" lay-skin="primary" value="${key}" checked="checked"  />
                        <span style="line-height: 44px;">
                            ${handlersMap[key].title }
                        </span>
                    </#list>
                    </div>
                </td>
            </tr>
            <tr>
                <td>反馈意见:</td>
                <td><textarea  name="memo" placeholder="请输入反馈意见" class="layui-textarea"></textarea></td>
            </tr>
        </table>
    </form>
</div>

<!--加签-->
<div id="addTransToDiv" style="margin: 10px;display:none;">
    <form class="layui-form" action="">
        <table class="layui-table">
            <tr>
                <td>添加用户</td>
                <td>
                    <input type="hidden" id="cmpIds" />
                    <textarea id="cmpNames" readonly="readonly" required lay-verify="required" class="layui-textarea"></textarea>
                    <i class="layui-icon layui-icon-username"><a href="javascript:;" onclick="chooseTransUsers()">选择人员</a></i>
                </td>
            </tr>
            <tr>
                <td>会签</td>
                <td>
                    <input type="radio" name="transType" value="1" title="非会签" checked>
                    <input type="radio" name="transType" value="2" title="会签" >
                </td>
            </tr>
            <tr>
                <td>流转结束后</td>
                <td>
                    <input type="radio" name="action" value="1" title="返回" checked>
                    <input type="radio" name="action" value="2" title="提交">
                </td>
            </tr>
            <tr>
                <td>备注</td>
                <td>
                    <textarea id="transOpinion" name="transOpinion" required lay-verify="required" maxLength="1000" class="layui-textarea"></textarea>
                </td>
            </tr>
            <tr>
                <td>提醒消息方式</td>
                <td>
                    <!--通知方式-->
                    <div class="layui-input-inline">
                        <#list handlersMap?keys as key>
                        <input type="checkbox" class="layui-input" lay-filter="informType" name="informType" lay-skin="primary" value="${key}" checked="checked"  />
                        <span style="line-height: 44px;">
                            ${handlersMap[key].title }
                        </span>
                        </#list>
                    </div>
                </td>
            </tr>
            <tr>
                <td>流转操作说明</td>
                <td>
                    <ul>
                        <li>1、添加用户：选择流转人员，可多选(其中会签状态下必须选多人)。</li>
                        <li>2、会签：选择非会签，则其中一个人审批完成流程就返回或提交；<br/>选择会签，则所选人员全部审批完成流程才返回或提交。</li>
                        <li>3、流转结束后，返回：流转结束后，原来的任务将会回到您的待办事项中；<br/>提交：流转结束后，流转人不需要执行原来的任务，流程就往下执行。</li>
                    </ul>
                </td>
            </tr>
        </table>
    </form>
</div>


<style>
    @media print {
        .noprint{display:none;}
        .printForm{display:block !important;}
        .noForm{font-size: 14px;font-weight: bold;text-align: center;}
    }

    .commonDiv{
        padding:10px 10px 0px 10px;
    }
    #opinionDiv{
        margin-top: 10px;
    }
    .opinionFieldSet{
        margin-top: 10px;
    }
    #cmpNames{
        min-height: 50px;
        width: 85%;
        display: inline-block;
    }
    .trans .layui-layer-btn a.layui-layer-btn2{
        background-color: #FF5722;
    }
    #customFormDiv .layui-input-block{
        margin-left: 0px;
    }
</style>
</body>
</html>
